import collections
class Solution(object):
    def displayTable(self, orders):
        d =collections.defaultdict(lambda :collections.defaultdict(int))
        food_set = set()
        for _, c, f in orders:
            d[int(c)][f] += 1
            food_set.add(f)
        id_list = list(d.keys())
        id_list.sort()
        food_list = list(food_set)
        food_list.sort()
        ans = []
        ans.append(['Table'] + food_list)
        for id in id_list:
            temp = []
            temp.append(str(id))
            for f in food_list:
                temp.append(str(d[id][f]))
            ans.append(temp)
        return ans
